<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>货物详情</title>
</head>
<script type="text/javascript" th:src="@{/js/jquery-2.2.4.js}"></script>
<body>
<a th:href="@{add.html}">添加货物</a>
<table width="500px" border="1px">
    <tr>
        <th>ID</th>
        <th>货物名</th>
        <th>货物类型</th>
        <th>重量</th>
        <th>操作</th>
    </tr>
    <tr th:each="records:${session.records}">
        <td th:text="${records.id}">1</td>
        <td th:text="${records.goodsName}">001</td>
        <td th:text="${records.goodsType}">xx</td>
        <td th:text="${records.goodsWeight}">xx</td>
        <td>
            <a th:href="@{update.html(id=${records.id},goodsName=${records.goodsName},goodsType=${records.goodsType},goodsWeight=${records.goodsWeight})}">更新</a>
            <a th:href="@{/del(id=${records.id})}">删除</a>
        </td>
    </tr>
</table>
    <ul>
        <li th:text="上一页" th:onclick="|previous('${session.cur}')|">上一页</li>
        <li th:each="i:${#numbers.sequence(1,session.pages)}" th:onclick="|cu('${session.cur}')|" th:text="${i}">

        </li>
        <li th:text="下一页" th:onclick="|next('${session.cur}')|">下一页</li>
        <li th:text="${session.total}"></li>
    </ul>
</body>
<script type="text/javascript">
    function previous(cur) {
        location.href="/all?current="+(Number(cur)-1);
    }
    function next(cur) {
        location.href="/all?current="+(Number(cur)+1);
    }
    function cu(cur) {
        location.href="/all?current="+Number(cur);
    }
</script>
</html>